package com.brush.app.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.brush.app.domain.AppProject;
import com.brush.app.domain.req.project.ProjectReq;
import com.brush.app.domain.resp.project.ProjectResp;
import com.brush.app.service.AppProjectService;
import com.brush.app.mapper.AppProjectMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
* @author Administrator
* @description 针对表【app_project(项目表)】的数据库操作Service实现
* @createDate 2024-10-31 16:44:54
*/
@Service
public class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProject>
    implements AppProjectService{

    @Override
    public PageInfo<ProjectResp> pagination(ProjectReq req) {
        return PageHelper.startPage(req.getPageNum(), req.getPageSize()).doSelectPageInfo(() -> {
            this.baseMapper.pagination(req);
        });
    }

    @Override
    public boolean add(ProjectReq req) {
        AppProject project = new AppProject();
        project.setName(req.getName());
        project.setImagePath(req.getImagePath());
        project.setOrderNum(req.getOrderNum());
        project.setRemark(req.getRemark());
        project.setTotal(req.getTotal());
        project.setStatus(req.getStatus());
        project.setCreateTime(req.getCreateTime());
        // 新增

        return this.save(project);
    }
}




